#!/bin/bash

dingtalk_robot_url="https://oapi.dingtalk.com/robot/send?access_token=7dcd4e90934d3a6e9e3f5d34cf0ba91376daf413839e54c7dc180f6b7c82fcc5"



myhostname=`hostname`

#for((i=0;i<5;i++));
for Row in 1 2 3 4 5;
do
    ips=`hostname -I`
    if [ ! -z "$ips" ]; then
        curl $dingtalk_robot_url -H 'Content-Type: application/json' -d '{"msgtype": "text","text": {"content":"【服务端】start server pc:'"$myhostname, $ips "'"}}'
        exit 0
    fi
    sleep 3s
done

curl $dingtalk_robot_url -H 'Content-Type: application/json' -d '{"msgtype": "text","text": {"content":"【服务端】start server pc:'"$myhostname, ip get failed "'"}}'